<div class="dux-tools">
  <div class="bread-head">扩展模型管理 <span class="small">管理网站内容所绑定的扩展模型</span> </div>
  <br>
  <div class="tools-function clearfix">
    <div class="float-left"> <a class="button button-small bg-back icon-list" href="__URL__/index"> 模型列表</a> </div>
    <div class="button-group float-right"> <a class="button button-small bg-dot icon-plus dropdown-toggle"> 添加字段 <span class="downward"></span></a>
      <ul class="drop-menu pull-right">
        <li><a href="javascript:;" onclick="add()">增加字段</a></li>
      </ul>
    </div>
  </div>
</div>
<div class="admin-main">
    <div class="panel dux-box">
      <div class="panel-head"> <strong>{$info.name} - 字段管理</strong> </div>
      <div class="table-responsive">
        <table id="table" class="table table-hover ">
          <tbody>
            <tr>
              <th width="*">排序</th>
              <th width="*">字段名称</th>
              <th width="*">字段</th>
              <th width="*">显示方式</th>
              <th width="*">必填</th>
              <th width="100">操作</th>
            </tr>
              <!--foreach:{$list $vo}-->
              <tr>
                <td>{$vo.sequence}</td>
                <td>{$vo.name}</td>
                <td>{$vo.field}</td>
                <td>{$vo.type} ({$vo.property})</td>
                <td>
                <!--if:{$vo['must']==1}-->
                <font color=green><b>√</b></font>
                <!--{else}-->
                <font color=red><b>×</b></font>
                <!--{/if}-->
                </td>
                <td>
                <a class="button bg-blue button-small icon-pencil" href="javascript:;" onclick="edit({$vo['fid']})" title="修改"></a>
               <a href="javascript:;" onclick="edit({$vo['fid']})" >修改</a>
                 <!--if:{$vo['primary']==0}-->
                 <a class="button bg-red button-small icon-trash-o js-del" href="javascript:void(0);" onclick="del('{$vo.fid}',this)" title="删除"></a>
                 <!--{else}-->
                 <a class="button bg-red button-small icon-trash-o js-del" href="javascript:void(0);" title="删除"></a>
                 <!--{/if}-->
                 </td>
              </tr>
              <!--{/foreach}-->
          </tbody>
        </table>
      </div>
    </div>
</div>
<script>
//添加
function add() {
	urldialog({
	title:'字段添加',
	url:'__URL__/field_add/mid-{$info.mid}'
	});
};
//修改
function edit(mid) {
	urldialog({
	title:'字段编辑',
	url:'__URL__/field_edit/fid-'+mid
	});
};
//删除
function del(fid,obj) {
	var obj;
	ajaxpost({
		name:'删除此字段会删除字段下的内容！',
		url:"__URL__/field_del",
		data:{fid: fid,mid: '{$info.mid}'},
		tip:1,
		success:function(){
			$(obj).parent().parent().remove();
		}
	});
}
</script>